import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';

import { Bearing } from  '../scheme/bearing';
import { BearingService } from '../scheme/bearing.service';

@Component({
	moduleId: module.id,
	selector: 'my-bearing-detail',
	templateUrl:'bearing-detail.component.html'
})
export class BearingDetailComponent implements OnInit {
	bear: Bearing;

	constructor(
		private bearingService: BearingService,
		private route: ActivatedRoute
	) {}

	ngOnInit(): void{
		this.route.params.forEach((params: Params) => {
			let id = params['id'];
			this.bearingService.getSingleBearing(id)
			.then(res => this.bear = res);
		})
	}
}
